Serverless
In this lesson, we'll study serverless.
We'll cover the following
Introduction#
PaaS deploy applications. Serverless goes even further and enables the deployment of individual functions.
Thereby, Serverless allows even smaller deployments than with PaaS. A REST service can be divided into a variety of functions, one per HTTP method and resource.
The advantages of Serverless are similar to those of PaaS:
- A high degree of abstraction and thus relatively simple deployment.
- Serverless functions are only activated when a request is made so that no costs are incurred if no requests are processed.
- They can also scale very flexibly.
Serverless technologies include:
- AWS Lambda
- Google Cloud Functions
- Azure Functions
- Apache OpenWhisk. OpenWhisk allows you to install a Serverless environment in your own data center.
As with a PaaS, Serverless includes support for operation. Metrics and log management are provided by the cloud provider.
REST with AWS Lambda and the API gateway#
With AWS Lambda, REST services can be implemented. The API gateway in the AWS cloud can call Lambda functions.
A separate function can be implemented for each HTTP operation. Instead of a single PaaS application, there are many Lambda functions.
A technology like Amazon SAM can make the large number of Lambda functions quite easy to use.
Even if there are a lot of functions to deploy, it is barely any more effort for the developers than if they implement the REST methods in a class. Often Lambda functions can significantly reduce the cost of running a solution.
Glue code#
In another area, Lambda functions are helpful; in response to an event in the Amazon Cloud, a Lambda function can be called.
S3 (Simple Storage Service) offers storage for large files in the Amazon Cloud. When a new file is uploaded, a Lambda function can convert it to another format.
However, these are not real microservices, but rather glue code to complement functionalities in Amazon services.
Q U I Z
What is a lambda function?
A)
A function that uses Greek letters in its name.
B)
AWS serverless function as a service product.
C)
A nameless function.
We’ll conclude this chapter in the next lesson.